 /**
 * Description: 物资入库明细
 * @author:hunter
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-04-08   hunter       1.0.0     Initial
 */
package com.metro.paperless.app.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import com.metro.paperless.app.beans.vo.AppOutDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.paperless.app.mapper.IAppInDetailMapper;
import com.metro.paperless.app.service.inf.IAppInDetailService;
import com.metro.paperless.app.beans.vo.AppInDetail;

import java.util.List;

 /**
 * 物资入库明细<br>
 *
 * @author:hunter
 * @since:1.0.0
 * @version [1.0.0, 2018-04-08]
 */
@Service("appindetailService")
public class AppInDetailService extends BaseServiceSupport<AppInDetail> implements IAppInDetailService{
    //物资入库明细Mapper
    @Autowired
    private IAppInDetailMapper appindetailMapper;

    @Override
    public IMapper getMapper() {
        return appindetailMapper;
    }

    @Override
    public IResult save(AppInDetail entity) {
        try {
            appindetailMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增物资入库明细失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(AppInDetail entity) {
        try {
            appindetailMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改物资入库明细失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            appindetailMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            appindetailMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

     @Override
     public List<AppInDetail> queryListByInId(Long id) {
         List<AppInDetail> inDetails = appindetailMapper.queryListByInId(id);
         return inDetails;
     }
 }